<?php

namespace App\Models;

class SysRegion extends Base
{
    public $timestamps = false;
    protected $connection = 'mysql_center';
    protected $table = 'sys_region';

    public function allChildren() {
        return $this->hasMany(SysRegion::class, 'parent_id', 'code')->select('id as value','name as label','code','parent_id  ');
    }

    public function children()
    {
        return $this->allChildren()->with('children');
    }
}
